<!DOCTYPE html>
<html lang="en">

<head>
    <{include file="header.html" }>
        <title>添加老师-老师管理-
            <{$user_data[ 'school_name']}>-德安信会计在线教育平台</title>
        <script>
        $(function() {
            $("#btn_save").click(function() {
                $("form").submit();
            });
        })
        </script>
</head>

<body>
    <div class="wrap">
        <!--star left-->
        <div class="column">
            <{include file="left_menu.html" }>
        </div>
        <div id="ContMianBox">
            <!--star子栏目-->
            <div class="sub-colum">
                <div class="tit"><{$left_menu_min.menu}></div>
                <ul>
                    <{foreach from=$left_menu_min.list item=item}>
                    <li <{if $item['url'] == $left_menu_min.curr}>class="curr"<{/if}>><a href="<{$item['url']}>"><{$item['name']}></a></li>
                    <{/foreach}>
                </ul>
            </div>
            <!--end子栏目-->
            <!--end left-->
            <div class="container narrow">
                <!--star conter-->
                <div class="cetContent">
                    <div class="tit p-lr20">
                        <a class="c-40d064" href="/teacher">老师管理</a><em class="p-lr10 c-CCCCCC fs12">/</em><em>添加老师</em>
                    </div>
                    <!--star内容区域-->
                    <div class="mainScroll">
                        <div class="mainContainer line-all">
                            <!-- <ul class="ui-nav-tab wList33">
					            <li class="js-step-1 active"><a href="javascript:;">1.编辑老师基本信息</a></li>
					            <li class="js-step-2"><a href="javascript:;">2.分配权限</a></li>
					        </ul> -->
                            <div class="tabMainCont">
                                <!--star 编辑基本信息-->
                                <div class="tabItem step-02 ">
                                    <form action="/teacher/teacher_add" class="layui-form" method="post">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">老师姓名：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="teacher_name" value="<{if isset($teacher_name)}><{$teacher_name}><{/if}>" placeholder="老师姓名" required lay-verify="required" autocomplete="off" class="layui-input">
                                                <{if isset($teacher_name_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <span class="tip" style=" padding:2px 5px;"><{$teacher_name_err}></span>
                                                    <{/if}>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">手机号：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="mobile" value="<{if isset($mobile)}><{$mobile}><{/if}>" maxlength="11" placeholder="登录的手机号" required lay-verify="required" autocomplete="off" class="layui-input">
                                                <{if isset($mobile_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <span class="tip" style=" padding:2px 5px;"><{$mobile_err}></span>
                                                    <{/if}>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">注：手机号码作为登录学校工作台的账号，请勿重复</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">登录密码：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="password" value="<{if isset($password)}><{$password}><{/if}>" maxlength="20" placeholder="登录密码" required lay-verify="required" autocomplete="off" class="layui-input">
                                                <{if isset($password_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <span class="tip" style=" padding:2px 5px;"><{$password_err}></span>
                                                    <{/if}>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">登录学校工作台的密码，请记住</div>
                                        </div>
                                        <div class="layui-form-item layui-form-text">
                                            <input type="hidden" id="token" value="<{'VIMG'|get_qiniu_token}>" />
                                            <label class="layui-form-label">头像</label>
                                            <div class="layui-input-block" style="margin-top: 5px;">
                                                <div id="uploader2" class="upload_box" style="float:left; width:420px;">
                                                    <div class="queueList">
                                                        <div id="dndArea2" class="placeholder dndArea">
                                                            <div id="filePicker2" class="filePicker"></div>
                                                            <p>或将照片拖到这里，最多可上传<script>document.write(fileNumLimit);</script>张图片</p>
                                                        </div>
                                                    </div>
                                                    <div class="statusBar" style="display:none;">
                                                        <div class="progress">
                                                            <span class="text">0%</span>
                                                            <span class="percentage"></span>
                                                        </div><div class="info"></div>
                                                        <div class="btns">
                                                            <div id="filePickerBut2" class="filePickerBut"></div><div class="uploadBtn">开始上传</div>
                                                        </div>
                                                    </div>
                                                    <div class="upload_img_input" input_name='header_img'></div>
                                                </div>
                                                <{if isset($header_img) AND $header_img != ''}>
                                                    <div class="layui-inline" style="float:left;"><img src="<{$header_img}>" style="max-height:175px;"/></div>
                                                <{/if}>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">性别：</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="sex" value="1" checked="" title="男">
                                                <input type="radio" name="sex" value="2" title="女">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">生日：</label>
                                            <div class="layui-input-inline">
                                                <input class="layui-input" placeholder="老师生日" name="birthday" onclick="layui.laydate({elem: this, istime: true, format: 'YYYY-MM-DD'})">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">老师特长：</label>
                                            <div class="layui-input-block">
                                                <textarea placeholder="描述老师特长" style="width:500px" name="speciality" class="layui-textarea"><{if isset($speciality)}><{$speciality}><{/if}></textarea>
                                                <{if isset($speciality_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <{$speciality_err}>
                                                        <{/if}>
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">老师简介：</label>
                                            <div class="layui-input-block">
                                                <textarea placeholder="老师简介" style="width:500px" name="intro" class="layui-textarea"><{if isset($intro)}><{$intro}><{/if}></textarea>
                                                <{if isset($intro_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <{$intro_err}>
                                                        <{/if}>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">状态：</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="status" value="1" title="全职">
                                                <input type="radio" name="status" value="2" title="兼职">
                                                <input type="radio" name="status" value="0" checked="" title="离职">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">评分：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="school_score" value="<{if isset($school_score)}><{$school_score}><{/if}>" maxlength="3" placeholder="学校给老师的评分，满分100" required lay-verify="required" autocomplete="off" class="layui-input">
                                                <{if isset($school_score_err)}>
                                                    <i class="layui-icon" style="font-size: 30px; color: red">&#x1007;</i>
                                                    <span class="tip" style=" padding:2px 5px;"><{$school_scoree_err}></span>
                                                    <{/if}>
                                            </div>
                                            <div class="layui-form-mid layui-word-aux">学校给老师的评分，满分100分</div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">开通直播：</label>
                                            <div class="layui-input-block">
                                                <input type="radio" name="allow_live" value="1" title="开通">
                                                <input type="radio" name="allow_live" value="0" checked="" title="不开通">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <div class="layui-input-block">
                                                <button class="layui-btn" lay-submit="" lay-filter="demo1">添加老师</button>
                                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                            </div>
                                        </div>
                                        <div class="p-tb30 tac">
                                            <!-- <a id="btn_save" href="JavaScript:;" class="zent-btn zent-btn-40d064" style="padding:0 50px;">添加老师并分配权限</a> -->
                                        </div>
                                    </form>
                                </div>
                                <!--end 编辑基本信息-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <{include file="footer.html"}>
    <script>
    layui.use(['form', 'layedit', 'laydate'], function() {
        var form = layui.form(),
            layer = layui.layer,
            layedit = layui.layedit,
            laydate = layui.laydate;



        //监听提交
        form.on('submit(demo1)', function(data) {
            var phone = $("input[name=mobile]").val();


            if (phone != "") {
                //判断用户是否存在
                $.ajax({
                    url: '/teacher/check_phone/' + phone,
                    type: 'get',
                    success: function(res) {
                        var json = eval('(' + res + ')');
                        if (json.code == 9) {
                            //该手机的主人已经是老师了
                            layer.alert("该手机的主人已经是老师了");
                            $("input[name=mobile]").fcous();
                            return false;
                        } else if (json.code == 0) {
                            return ture;
                        }

                    }
                });

                return ture;
            }


        });


    });
    </script>
</body>

</html>
